<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/css/plugins/layui/css/layui.css}" >
</head>
<body>
    <div th:object="${student}" class="layui-form">
        <input type="hidden" id="id" th:field="*{studentId}">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">学生名称</label>
                <div class="layui-input-inline layui-input-wrap">
                    <input type="text" id="studentName"  th:field="*{studentName}" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-inline layui-input-wrap">
                    <input type="text" id="gender"  th:field="*{gender}"  class="layui-input" >
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">所属班级</label>
                <div class="layui-input-inline layui-input-wrap">
                    <select id="claId" name="claId" th:with="clas=${@claService.list()}">
                        <option value="">请选择</option>
                        <option th:each="d : ${clas}" th:text="${d.claName}" th:value="${d.claId}" th:selected="${student.cla != null && d.claId == student.cla.claId}"></option>
                    </select>
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">所属宿舍</label>
                <div class="layui-input-inline layui-input-wrap">
                    <select id="hostelId" name="hostelId" th:with="hostels=${@hostelService.list()}">
                        <option value="">请选择</option>
                        <option th:each="h : ${hostels}" th:text="${h.hostelName}" th:value="${h.hostelId}" th:selected="${student.hostel != null && h.hostelId == student.hostel.hostelId}"></option>
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">所属专业</label>
                <div class="layui-input-inline layui-input-wrap">
                    <select id="majorId" name="majorId" th:with="majors=${@majorService.list()}">
                        <option value="">请选择</option>
                        <option th:each="m : ${majors}" th:text="${m.majorName}" th:value="${m.majorId}" th:selected="${student.major != null && m.majorId == student.major.majorId}"></option>
                    </select>
                </div>
            </div>
        </div>

    </div>
<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/plugins/layui/layui.js}"></script>
<script>
    // 异步请求加载部门列表
    layui.use(function (){
        var laydate = layui.laydate;
        laydate.render({
            elem: '#birthday',
            type: 'date'
        });
    })

</script>
</body>
</html>
